﻿#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_Cal_clicked()
{
    int count=ui->lineEdit_Count->text().toInt();
    float price=ui->lineEdit_Price->text().toFloat();
    float total=count*price;
    ui->lineEdit_Total->setText(QString::number(total,'f',2));
}

void MainWindow::on_pushButton_10_clicked()
{
    int value=ui->lineEdit_10->text().toInt();
    ui->lineEdit_2->setText(QString::number(value,2));
    ui->lineEdit_16->setText(QString::number(value,16));
}

void MainWindow::on_pushButton_2_clicked()
{
    bool ok;
    int value=ui->lineEdit_2->text().toInt(&ok,2);
    ui->lineEdit_10->setText(QString::number(value,10));
    ui->lineEdit_16->setText(QString::number(value,16));
}

void MainWindow::on_pushButton_16_clicked()
{
    bool ok;
    int value=ui->lineEdit_16->text().toInt(&ok,16);
    ui->lineEdit_10->setText(QString::number(value,10));
    ui->lineEdit_2->setText(QString::number(value,2));
}
